import Vue from 'vue'
import VueRouter from 'vue-router'

import DataConfirm from '../views/dataConfirm'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Login',
        show: 'false',
        component: () => import('../views/login.vue')
    },
    {
        path: '/main',
        name: 'MainPage', //主页
        show: true,
        component: () => import('../views/main.vue'),
        //redirect: '/main/currMonitor',
        // 主页下属的左侧菜单栏数据
        // 1：管理员，具有最高权限
        // 2：岗位操作人员，普通权限
        // 3：技术人员，比岗位操作人员权限高
        children: [
            {
                name: '实时监控模块',
                path: '/main/currMonitor',
                show: true,
                authority:[1,2,3],
                redirect:'/main/currMonitor/onTimeMonitor.vue',
                component: () => import('../views/middle.vue'),
                children:[{
                    name:'实时监控',
                    path:'/main/currMonitor/monitoring',
                    component:()=>import('../views/onTimeMonitor.vue'),
                    show:true
                }]
            },
            {
                name: '人员管理模块',
                path: '/main/userManage',
                show: true,
                authority:[1],
                redirect: '/main/userManage/userList',
                component: () => import('../views/middle.vue'),
                children: [
                    {
                        name: '用户列表',
                        //path: '/main/userManage/userList',
                        path: '/main/userManage/userList',
                        component: () => import('../views/userList.vue'),
                        show: true
                    },
                    {
                        name: '添加用户',
                        path: '/main/userManage/userCreate',
                        component: () => import('../views/userCreate.vue'),
                        show: true
                    },
                    {
                        name: '编辑用户信息',
                        path: '/main/userManage/userUpdate',
                        component: () => import('../views/userUpdate.vue'),
                        show: false
                    }
                ]
            },
            {
                name:'岗位人员操作模块',
                path:'/main/workerModule',
                show:true,
                authority: [1,2],
                redirect:'/main/workerModule/dataConfirm',
                component: () => import('../views/middle.vue'),
                children:[
                    {
                        name:'料仓参数和料批质量确认',
                        path:'/main/workerModule/dataConfirm',
                        show:true,
                        component:DataConfirm
                    }
                ]

            },
            {
                name:'技术人员操作模块',
                path:'/main/technician',
                show:true,
                authority: [1,3],
                redirect: '/main/technician/optimizeSetup',
                component: () => import('../views/middle.vue'),
                children:[
                    {
                        name:'配料优化设定',
                        path:'/main/technician/optimizeSetup',
                        show:true,
                        component:()=>import('../views/optimizeSetup.vue')
                    },
                    {
                        name:'上下限设定',
                        path:'/main/technician/limitSetup',
                        show:true,
                        component:()=>import('../views/limitSetup.vue')
                    },
                    {
                        name:'配料标准设定',
                        path:'/main/technician/standardSetup',
                        show:false,
                        component:()=>import('../views/standardSetup.vue')
                    }
                ]

            },
            {
                name:'数据分析模块',
                path:'/main/dataAnalyze',
                show:true,
                authority: [1,2,3],
                redirect: '/main/dataAnalyze/reportQuery',
                component: () => import('../views/middle.vue'),
                children:[
                    // {
                    //     name:'报表查询',
                    //     path:'/main/dataAnalyze/reportQuery',
                    //     show:true,
                    //     component:()=>import('../views/reportQuery.vue')
                    // },
                    {
                        name:'直方图分析',
                        path:'/main/dataAnalyze/histogram',
                        show:true,
                        component:()=>import('../views/histogram.vue')
                    },
                    // {
                    //     name:'数据对比分析',
                    //     path:'/main/dataAnalyze/dataCompare',
                    //     show:true,
                    //     component:()=>import('../views/dataCompare.vue')
                    // }
                ]
            },
            {
                name:'数据接口',
                path:'/dataInterface',
                show:true,
                authority:[1,2,3],
                component:()=>import('../views/middle.vue'),
                children: [
                    {
                        name:'录入成品球参数和混合料数据',
                        path:'/dataInterface/cpqcs',
                        show:true,
                        component:()=>import('../views/dataInterface.vue')
                    }
                ]
            }
        ]
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
